<?php
require_once("news/parse/mysql.php");
require_once("news/parse/grabber.inc");

$currentTimeFunc = date("Y/n/j G:i:s");


$fd = fopen("logs/schedule.log", "w");
fwrite($fd, $currentTimeFunc." task executed\n");
fclose($fd);


$passedDate = date("Y-n-j");
$passedDate1 = date("Y-m-d");


$passedSuffix = "?do=geteventinfo&day=";
$passedUrl = "http://www.forexfactory.com/calendar.php";

	$newsText = new newsGrabber ($passedUrl, $passedSuffix, $passedDate);


	if($newsText->dataLoaded) {
		$parsedText = new newsParser($newsText->getFileContent());

		$parsedText->extractNewsHTML("detail_row_seek_");

		if (!isset($parsedText->noNews)){
			$plainText = new Html2Text($parsedText->extractNewsHTML("detail_row_seek_"),2000);
			$parsedText->extractedHTML = $plainText->convert();
			
			//$parsedText->parsePlainText2Array();
			
	        insert2DB($parsedText->parsePlainText2Array(),$passedDate1);

		}
	}






?>